local Entity = class("Entity")
local device = require("ihome.helper.device")
function Entity:ctor( )
	self._components = {}
	self._name = {}
	self._id = device.chipid()
end

function Entity:addCompoment(comp)
	local cls_type = comp.__cname
	if self._components[cls_type] then return end 
	self._components[cls_type] = comp
	print("Add componetn suc!")
end

function Entity:getCompoment(cls) 
	return self._components[cls.__cname]
end

function Entity:dispose()
	for _, comp in ipairs(self._components) do 
		comp:dispose()
	end
	self._components = {}
end

return Entity 